home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / SUPERPD.PAK / LINKITEM.CPP < prev    next >
C/C++ Source or Header  |  1997-05-06  |  1KB  |  51 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1995 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10.  
  11.  
  12. #include "stdafx.h"
  13. #include "padview.h"
  14. #include "paddoc.h"
  15. #include "paditem.h"
  16. #include "linkitem.h"
  17. #include <limits.h>
  18.  
  19. IMPLEMENT_DYNAMIC(CPadLinkItem, CEmbeddedItem)
  20.  
  21. CPadLinkItem::CPadLinkItem(CPadDoc* pContainerDoc, LPCTSTR pszItemName)
  22.     : CEmbeddedItem(pContainerDoc)
  23. {
  24.     CString strItemName(pszItemName);
  25.     SetItemName(strItemName);
  26.     _stscanf(strItemName, _T("%d %d"), &m_nBeg, &m_nEnd);
  27. }
  28.  
  29. CPadLinkItem::CPadLinkItem(CPadDoc* pContainerDoc, int nFrom, int nTo)
  30.     : CEmbeddedItem(pContainerDoc)
  31. {
  32.     m_nBeg = nFrom;
  33.     m_nEnd = nTo;
  34.     TCHAR buf[30];
  35.     wsprintf(buf, _T("%d %d"), m_nBeg, m_nEnd);
  36.     SetItemName(buf);
  37. }
  38.  
  39. void CPadLinkItem::OnShow()
  40. {
  41.     CPadDoc* pDoc = (CPadDoc*)GetDocument();
  42.     ASSERT(pDoc != NULL);
  43.     ASSERT_VALID(pDoc);
  44.     ASSERT_KINDOF(CPadDoc, pDoc);
  45.     pDoc->SetSelection(m_nBeg, m_nEnd);
  46.  
  47.     CEmbeddedItem::OnShow();
  48. }
  49.  
  50. /////////////////////////////////////////////////////////////////////////////
  51.